const express=require('express');
//服务器需要调用方法和数据（dao，router）
const slideImgService=require('../service/slideImgService');
const menService=require('../service/menService');
const womenService=require('../service/womenService');
const wearService=require('../service/wearService');
const mobileService=require('../service/mobileService');
var router=express.Router();

//use/get/post  都可以
router.use('/img', async function (req,res,next) {
    var data=await slideImgService.findAllSlideImgs();
    //console.log(data);
    res.send(data);
});

//men的显示
router.use('/mens', async function (req,res,next) {
    var data=await  menService.findByKind(req.query.kind);
    //console.log(data);
    res.send(data);
});

//women的显示
router.use('/womens', async function (req,res,next) {
    var data=await  womenService.findByKind(req.query.kind);
    //console.log(data);
    res.send(data);
});

//kids的显示
router.use('/kids', async function (req,res,next) {
    var data=await  wearService.findByKind(req.query.kind);
    //console.log(data);
    res.send(data);
});
//mobie 的显示
router.use('/mobiles', async function (req,res,next) {
    var data=await  mobileService.findByKind(req.query.kind);
    //console.log(data);
    res.send(data);
});

exports.router=router;







